/*
 * Copyright (C) 2009 Dimitrios C. Michalakos
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.restsql.http;

//import com.cs.util.binary.Base16;
import java.io.IOException;
//import javax.mail.BodyPart;
//import javax.mail.MessagingException;

/**
 * BodyPartParser can be used for parsing BodyPart objects.
 * @author dimitris@jmike.gr
 */
public class BodyPartParser {
//
//    public static String getName(BodyPart bodyPart) throws MessagingException {
//        if (bodyPart.getDisposition().equals("form-data")) {
//            final String[] h = bodyPart.getHeader("Content-Disposition");
//            if (h != null && h.length > 0) {
//                final int a = h[0].indexOf("\"") + 1;
//                final int b = h[0].indexOf("\"", a);
//                return h[0].substring(a, b);
//            }
//        }
//        return "";
//    }
//
//    public static String getValue(BodyPart bodyPart) throws MessagingException, IOException {
//        if (bodyPart.getContentType().equals("text/plain")) {
//            return (String) bodyPart.getContent();
//        } else {
//            return Base16.toHexString(bodyPart.getInputStream().toString().getBytes());
//        }
//    }
}
